﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

public partial class ItemDetail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            if (Convert.ToString(Request.QueryString["ItemID"]) != null)
            {
                ListBind2();
              
            }

        }
    } 
    SqlConnection con = new SqlConnection();
    DataSet dsImages = new DataSet();
    string cnt = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
    private void ListBind2()
    {
        string qry = "select * from tbItems where ItemID=" + Convert.ToString(Request.QueryString["ItemID"]);
        SqlDataAdapter adp = new SqlDataAdapter(qry, cnt);
        DataSet ds = new DataSet();
        adp.Fill(ds);
        lblGroupName.Text = Convert.ToString(ds.Tables[0].Rows[0]["ItemTitle"]);
        Image1.ImageUrl = Convert.ToString(ds.Tables[0].Rows[0]["ItemThumbPath"]);
        lblDsc.Text = Convert.ToString(ds.Tables[0].Rows[0]["ItemDsc"]);
        //DataList2.DataSource = ds;
        //DataList2.DataBind();
    }
    protected void DataList2_ItemCommand(object source, DataListCommandEventArgs e)
    {

    }
    protected void DataList2_ItemDataBound(object sender, DataListItemEventArgs e)
    {

    }
    protected void backButton_Click(object sender, EventArgs e)
    {
        var groupID=Convert.ToString(Request.QueryString["GroupID"]);
        if (groupID == null)
        {
            Response.Redirect("Home.aspx");
        }
        else
        {
            Response.Redirect("GroupDetail.aspx?GroupID=" + groupID);
        }
    }
    protected void btnAddSubItem_Click(object sender, EventArgs e)
    {
        Response.Redirect("WebControls/Item_child.aspx?ItemID=" + Convert.ToString(Request.QueryString["ItemID"]));
    }
}